package com.abou.manager.admin.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import com.abou.connector.dao.IAccountDao;
import com.abou.manager.admin.IAccountManager;
import com.abou.model.admin.Account;

/**
 * The implementation class of the account manager.
 * 
 * @author khalid
 */
@Transactional(propagation = Propagation.REQUIRED)
public class AccountManagerImpl implements IAccountManager {
  
  @Autowired
  private IAccountDao accountDao;
  
  /**
   * The empty constructor
   */
  public AccountManagerImpl() {

    super();
  }
  
  /**
   * @see com.abou.manager.admin.IAccountManager#createAccount(com.abou.model.admin.Account)
   */
  public void createAccount(Account account) {

    accountDao.create(account);
  }
  
  /**
   * @see com.abou.manager.admin.IAccountManager#getAccount(java.lang.String)
   */
  public Account getAccount(String owner) {

    return accountDao.find(owner);
  }
  
  /**
   * @see com.abou.manager.admin.IAccountManager#setAccount(com.abou.model.admin.Account)
   */
  public void setAccount(Account account) {

    accountDao.merge(account);
  }
  
}
